import config from '../config'
type mapKey = keyof typeof config.image
export const image = new Map<mapKey, HTMLImageElement>()

export const promises = Object.entries(config.image).map(([key, value]) => {
  const img = document.createElement('img')
  return new Promise(resolve => {
    img.src = value
    img.onload = () => {
      image.set(key as mapKey, img)
      resolve(img)
    }
  })
})
